<%@ page contentType="text/html; charset=utf-8"%>
<%@ include file="../../../common/include.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title>日志管理</title>
	<jsp:include page="../../../common/head.jsp">
		 <jsp:param name="_spPage" value="true"/>
		 <jsp:param name="_useCalendar" value="true"/>
	</jsp:include>
		<script  language="javaScript">
	//导出
	function exportLog()
	{
		if(confirm("将按照上方查询条件将日志导出，确定要导出日志吗？"))
		{
			form1.target="_blank";
			form1.action="exportLog.do";
			form1.submit();
			queryLog();
		}	
	}
	//查询
	function queryLog()
	{
		form1.target="_self";
		form1.action="listLog.do";
		form1.submit();
	}
	
	function showLog(src){
		var url="jump.do?path=showLog.do&loginfo.logId="+src;
		var a = ModalWindow(url,800,600);
		
	}
	//删除指定的日志
	function deleteLog()
	{
		var logId=document.getElementsByName("logId");
		var str = xjCommon.getValueStr("logId",",");
		if(str!=null && str.length>0){
			if(confirm("确定要删除日志吗！")){
				var a=ModalWindow('jump.do?path=deleteLog.do&logId='+str,800,600);    
				if(a=="ok")
					xjSpPage.spPageSubmit();
			}
		}
		else
			alert("请选择要移除的日志!");
	}
</script>
	</head>
	<body>
		<form id="form1" method="post" action="listLog.do">
	<div id="body_div">
	<w:ShowTitle name="日志管理" useSubmitKey="false">
	<w:TitleButton funcName="查询" onClickFunction="_queryDivBg(this)" urlImg="${ctx}/images/main/query.png"/>
	<w:TitleButton funcName="导出" onClickFunction="exportLog()" urlImg="${ctx}/images/main/add.png"/>
	<w:TitleButton funcName="移除日志" onClickFunction="deleteLog()" urlImg="${ctx}/images/main/delete.png"/>
	</w:ShowTitle>
	<div id="body_content">
	<div id="queryDiv">	
					<table width="100%">
						<tr>
							<td class="td_title" colspan="4">
								日志查询
							</td>
						</tr>
						<tr>
							<td width="110">
								用户姓名
							</td>
							<td width="120" class="left_align">
								<input type="text" name="loginfo.userName" maxlength="10" value="${loginfo.userName}"/>
							</td>
							<td width="110">
								用户帐号
							</td>
							<td width="120" class="left_align">
								<input type="text" name="loginfo.userId" maxlength="20" value="${loginfo.userId}"/>
							</td>
						</tr>
						<tr>
							<td width="110">
								用户IP
							</td>
							<td width="120" class="left_align">
								<input type="text" name="loginfo.ipAddress" maxlength="50" value="${loginfo.ipAddress}"/>
							</td>
							<td width="110">
								操作类型
							</td>
							<td width="120" class="left_align">
								<input type="text" name="loginfo.handleType" maxlength="20" value="${loginfo.handleType}"/>
							</td>
						</tr>
						<tr>
							<td width="110">
								开始时间
							</td>
							<td width="120" class="left_align">
								<input name="dateFrom" value="${dateFrom}" type="text" onClick="WdatePicker()" readonly="readonly" class="inputCal"/>
							</td>
							<td width="110">
								结束时间
							</td>
							<td width="120" class="left_align">
							<input name="dateTo" value="${dateTo}" type="text" onClick="WdatePicker()" readonly="readonly" class="inputCal"/>
							</td>
						</tr>
						<tr>
							<td width="110">
								请求路径
							</td>
							<td width="120" class="left_align">
								<input type="text" name="loginfo.requestUrl" value="${loginfo.requestUrl}"/>
							</td>
							<td width="110">
							</td>
							<td width="120" class="left_align">
							</td>
						</tr>
						<tr>
							<td colspan="4">
								<input name="new_button5" type="button" class="btn_standard" onClick="queryLog()" value="查  询"/>
								<input name="button" type="button" class="btn_standard" onclick="_cancelQuery()" value="取消" />
							</td>
						</tr>
					</table>
				</div>
					<table width="100%" class="listTable">
						<tr>
							<td width="40" class="td_title"><span onclick="xjCommon.checkAll('logId')">全选</span></td>
							<td class="td_title">
								操作时间
							</td>
							<td class="td_title">
								操作类型
							</td>
							<td class="td_title">
								用户IP
							</td>
							<td class="td_title">
								用户帐号
							</td>
							<td class="td_title">
								用户名称
							</td>
							<td class="td_title">
								URI
							</td>
							<td class="td_title">
								操作
							</td>
							
						</tr>

						<c:forEach items="${logList}" var="l" varStatus="indx">
							<tr>
								<td><input type="checkbox" name="logId"  value="${l.logId}" id="logId"/></td>
								<td>
									${l.handleTime}
								</td>
								<td >
									${l.handleType}
								</td>
								<td>
									${l.ipAddress}
								</td>
								<td>
									<c:out value="${l.userId}" />
								</td>
								<td>
									<c:out value="${l.userName}" />
								</td>
								<td>
									<c:out value="${l.requestUrl}" />
								</td>
								<td>
									<a href="#" onclick="showLog('${l.logId}')">
										查看
									</a>
								</td>
								
							</tr>
						</c:forEach>
					</table>
					<w:spPage/>
			</div>
			</div>
		</form>
	</body>
</html>
